package com.itheima.web.mapper.pms;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.vo.pms.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper extends BaseMapper<Product> {

    List<Product> pageInfo(@Param("pageNum") int pageNum,@Param("pageSize") int pageSize,@Param("product") Product product);

    @Select("select * from pms_product where name like #{keyword}}")
    Product selectByKeyword(@Param("keyword") String keyword);

    void updateByIds(@Param("ids") List<Integer> ids, @Param("deleteStatus") Integer deleteStatus);

    void updateWithNewStatus(@Param("ids") List<Integer> ids,@Param("newStatus") Integer newStatus);

    void updateWithPublishStatus(@Param("ids") List<Integer> ids, @Param("publishStatus") Integer publishStatus);

    void updateWithreCommendStatus(@Param("ids") List<Integer> ids,@Param("recommendStatus") Integer recommendStatus);

    void updateWithreVerifyStatus(@Param("ids") List<Integer> ids,@Param("verifyStatus") Integer verifyStatus);

    List<Product> selectBy(int id);

    @Select("select * from pms_product where id=#{id}")
    Product get(Integer id);

    long countByStatus(@Param("product") Product product);
}
